<?php echo $this->renderElement('admin/menu'); ?>
<br />
<?php
echo "<td>".$html->link(__('add_company', true), '/companies/add')."</td>";
?>
<br /><br />
<h2><?php echo __('list_companies'); ?></h2>
<div class="largebloc2">
<br />
<table width="100%">
<th>#id</th><th><?php echo __('name'); ?></th><th><?php echo __('address'); ?></th>
<?php
if ($user['rank'] == 1)
	echo "<th>Actions</th>";
?>
<?php
	foreach($companies as $company):
		echo "<tr>";
		echo "<td>".$html->link("#".$company['Company']['id'], '/companies/view/'.$company['Company']['id'])."</td>";
		echo "<td>".$html->link($company['Company']['name'], '/companies/view/'.$company['Company']['id'])."</td>";
		echo "<td>".$company['Company']['address']."</td>";
		
		if ($user['rank'] == 1){
			echo "<td>";
			echo $html->link(__('view', true), '/companies/view/'.$company['Company']['id']);
			echo " | ";
			echo $html->link(__('edit', true), '/companies/edit/'.$company['Company']['id']);
			echo " | ";
			echo $html->link(__('delete', true), '/companies/del/'.$company['Company']['id']);
			echo "</td>";
		}
			
		echo "</tr>";
	endforeach;
?>
</table>
</div>